/* eslint-disable react/jsx-no-target-blank */
import React from 'react';

import vv from '@/assets/icon/vv.png';
import weibo from '@/assets/icon/weibo.png';
import weixin from '@/assets/icon/WeChat.png';
import zhihu from '@/assets/icon/zhihu.png';

import facebook from '@/assets/icon/facebook.png';
import instagram from '@/assets/icon/instagram.png';
import linkedin from '@/assets/icon/linkedin.png';
import styles from './index.less';

const FollowVV = ({ user }) => {
    let json = [
        {
            name: 'vv',
            url: 'http://www.vv.cn',
            from: 'cn',
            icon: vv
        },
        {
            name: 'weibo',
            url:
                'https://weibo.com/p/1006067150692334/home?from=page_100606&mod=TAB#place',
            from: 'cn',
            icon: weibo
        },
        {
            name: 'weixin',
            url: 'https://mp.weixin.qq.com/s/vLTlb1JzdxaQegH7W0JMPQ',
            from: 'cn',
            icon: weixin
        },
        {
            name: 'zhihu',
            url: 'https://www.zhihu.com/org/wei-wei-ke-ji-52/activities',
            from: 'cn',
            icon: zhihu
        },
        {
            name: 'vvSg',
            url: 'http://www.vv.com.sg',
            from: 'sg',
            icon: vv
        },
        {
            name: 'linkedin',
            url: 'https://www.linkedin.com/company/vvtechnology/',
            from: 'sg',
            icon: linkedin
        },
        {
            name: 'instagram',
            url: 'https://www.instagram.com/vvtechnologysg/',
            from: 'sg',
            icon: instagram
        },
        {
            name: 'facebook',
            url: 'https://www.facebook.com/vvtechnologysg/',
            from: 'sg',
            icon: facebook
        }
    ];
    // 根据公司id过滤内容
    if (user && user.companyId === 101) {
        json = json.filter(item => {
            if (item.from === 'cn') {
                return item;
            }
            return '';
        });
    } else {
        json = json.filter(item => {
            if (item.from === 'sg') {
                return item;
            }
            return '';
        });
    }
    return (
        <div className={styles.vv_Follow}>
            <strong className={styles.vv_title}>关注微微</strong>
            <ul>
                {json.map(item => (
                    <li key={item.name}>
                        <a href={item.url} target="_blank">
                            <img src={item.icon} alt={item.name} />
                        </a>
                    </li>
                ))}
            </ul>
        </div>
    );
};
export default FollowVV;
